package com.ndp.fb.walle.business;

import java.util.List;
import java.util.Map;

import com.ndp.fb.rdb.model.ConnectionObject;
import com.ndp.fb.rdb.model.EntrustAccount;
import com.ndp.fb.rdb.model.Pager;
import com.ndp.fb.rdb.model.adpublishcondition.AdPublishCondition;
import com.ndp.fb.rdb.model.adpublishcondition.AdPublishConditionAccount;
import com.ndp.fb.rdb.model.adpublishcondition.AdPublishConditionDetail;
import com.ndp.fb.rdb.model.adpublishcondition.AdPublishConditionResult;
import com.ndp.fb.rdb.model.adpublishcondition.RegionAndPrice;
import com.ndp.fb.rdb.model.adpublishcondition.UserConnectionPage;
import com.ndp.fb.walle.model.vo.adpublishcondition.param.AdPublishConditionDetailParam;
import com.ndp.fb.walle.model.vo.adpublishcondition.result.AdPublishConditionDetailResult;
import com.ndp.fb.walle.model.vo.connectionobject.result.ConnectionObjectExtVo;

/**
 * Created by Evan on 2015/3/24 16:05.
 */
public interface AdPublishConditionService {

     Pager<AdPublishConditionResult> findAdPublishConditionWithPager(String  userId, String name, Long orgId, Integer firstResult, Integer sizeNo);
    /**
     * 按 产品和配置找是否设置过
     */
    /**
     * 按id 查找主表
     */
     AdPublishCondition findAdPublishConditionById(Long id);

    /**
     * 更新 条件 投放状态
     */
     AdPublishCondition updateStatus(String userId, Long id, int status);

    /**
     * 更新detail
     */
     void updateDetail(AdPublishConditionDetailParam param, String userId);

    /**
     * 保存detail
     */
     Long saveDetail(AdPublishConditionDetailParam param,String userId);


    AdPublishConditionDetail findDetailById(String userId, Long connObjId, Long prodCfgId);
    /**
     * 根据平台获取产品配置
     * @param userId
     * @param connObjId
     * @param platform
     * @return
     */
    AdPublishConditionDetail findDetailByConnObjIdPlatForm(String userId, Long connObjId, String platform);

    /**
     * 按conditionId 查找detail表
     */
    AdPublishConditionDetail findDetailByConditionId(Long conditionId);

    List<AdPublishConditionAccount> findAdPublishConditionAccount(Long conditionId,String userId);

    /**
     *  获取应用 配置 用户 下的可发广告账号
     */
    List<EntrustAccount> findAllowedAccounts(String userId, Long connObjId, Long prodCfgId);

    List<RegionAndPrice> findRegionAndPrice(Long conditionId);

    List<ConnectionObject> findByTypeAndUserId(int type,String userId) throws Exception;

    /**
     * 公司下投放控制打开的外链产品
     */
    List<ConnectionObjectExtVo> findOpenedOutlinkByUserIdAndOrgId(String userId, Long orgId);

    /**
     * 公司下所有的外链产品
     */
    List<ConnectionObject> findOutlinkByOrgId(Long orgId);

    Map<String, Object> processHistoryDatas();
    
    AdPublishConditionDetailResult getAdPublishConditionDetailResult(Long conditionId);
    
    AdPublishConditionDetailResult getAdPublishConditionDetailResult(String userId, Long connObjId, String platform);


    List<UserConnectionPage> findPageIdsByUserId(String userId);
}
